<%@Import NameSpace="System.IO"%>
<%@Import NameSpace="System"%>
<% @ Page Language="C#" %>
<%


DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970,1,1));
DateTime dtNow = DateTime.Parse(DateTime.Now.ToString());
TimeSpan toNow = dtNow.Subtract(dtStart);
string timeStamp = toNow.Ticks.ToString();
timeStamp = timeStamp.Substring(0,timeStamp.Length - 7);


String savePath = "/UpLoad/Djack";
String savePicName = timeStamp;

string type = Request.QueryString["type"];

switch (type)
{
    case "food":
        savePath = "/UpLoad/niceFood/";
        break;
    case "scenic":
        savePath = "/UpLoad/scenic/";
        break;
    case "specialty":
        savePath = "/UpLoad/specialty/";
        break;
    case "transaction":
        savePath = "/UpLoad/transaction/";
        break;
    case "comments":
        savePath = "/UpLoad/comments/";
        break;
    default:
        savePath = "/UpLoad/Djack/";
        break;
}

String file_src = savePath + savePicName + "_src.jpg";
String filename162 = savePath + savePicName + "_162.jpg"; 
//String filename48 = savePath + savePicName + "_48.jpg"; 
//String filename20 = savePath + savePicName + "_20.jpg"; 


String pic = Request.Form["pic"];
String pic1 = Request.Form["pic1"];

//原图
if (pic.Length == 0) {
}else {
	byte[] bytes = Convert.FromBase64String(pic);  //将2进制编码转换为8位无符号整数数组
	
	FileStream fs =new FileStream(Server.MapPath(file_src),System.IO.FileMode.Create);
	fs.Write(bytes, 0, bytes.Length);
	fs.Close();
}


if(pic1.Length == 0){
}else {
	byte[] bytes1 = Convert.FromBase64String(pic1);  //将2进制编码转换为8位无符号整数数组.

	//图1
	FileStream fs1 =new FileStream(Server.MapPath(filename162),System.IO.FileMode.Create);
	fs1.Write(bytes1, 0, bytes1.Length);
	fs1.Close();
}




String picUrl = savePath + savePicName;

Response.Write("{\"status\":1,");
Response.Write("\"picUrl\":\""+picUrl+"\"}");

%> 